package com.haoshuang.zhouzhoubang.ui.page.order.contact

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.OrderWorkerBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class ContactWorkerViewModel : BaseViewModel() {

    /**
     * 查询订单服务人员
     */
    val getOrderServiceMemberData = StatefulMutableLiveData<MutableList<OrderWorkerBean>>()
    fun getOrderServiceMember(id: String) = netRequest {
        start { getOrderServiceMemberData.value = StateData.Loading }
        request { ApiRepo.getOrderServiceMember(id)  }
        success { getOrderServiceMemberData.value = StateData.Success(it.data) }
        error { code, msg ->
            getOrderServiceMemberData.value = StateData.Error(code, msg)
        }
    }
    
}